package com.jch.dm.chapter_22_command.drawer;

import com.jch.dm.chapter_22_command.command.Command;

import java.awt.*;

/**
 * @author: Administrator
 * “绘制一个点的命令”类
 * @create: 2020/04/13 16:16
 **/
public class DrawCommand implements Command {
    /**
     * 绘制对象
     */
    protected Drawable drawable;
    /**
     * 绘制位置
     */
    private Point position;

    public DrawCommand(Drawable drawable, Point position) {
        this.drawable = drawable;
        this.position = position;
    }

    /**
     * 执行
     */
    @Override
    public void execute() {
        drawable.draw(position.x,position.y);
    }
}
